<script setup>
import blogStore from "@/stores/blog.js";
import {Operation, Avatar, ArrowDown} from "@element-plus/icons-vue";


const goBack = () => {
  router.back()
  console.log('go back')
}
const blog = blogStore()


/*退出登陆按钮,取面包屑的key*/

const router = useRouter()
const Logout = () => {
  blog.token = ''
  blog.user = ''
  ElMessage({
    showClose: true,
    message: '退出成功！'

  })
  router.push("/login")
}
</script>

<template>
  <div class="bread">
    <el-icon>
      <Operation/>
    </el-icon>
    <el-breadcrumb style=" font-size: 16px; margin-left: 10px;margin-top: 2px">
      <el-breadcrumb-item>{{ blog.key }}</el-breadcrumb-item>
    </el-breadcrumb>


    <!--       退出登陆和用户右上角 -->


    <div class="lg-down ">
      <el-dropdown>
        <el-button :icon="Avatar" round type="warning">
          {{ blog.user }}
          <el-icon class="el-icon--right">
            <arrow-down/>
          </el-icon>
        </el-button>
        <template #dropdown>
          <el-dropdown-menu>
            <el-dropdown-item>个人中心</el-dropdown-item>
            <el-dropdown-item @click="Logout">退出登陆</el-dropdown-item>
          </el-dropdown-menu>
        </template>
      </el-dropdown>

    </div>


  </div>

</template>

<style scoped>

.lg-down {
  position: absolute;
  right: 0;
  top: 10px; /* 移动到容器的一半高度 */
  margin-right: 50px;

}


.bread {
  width: 400px;
  margin-top: 16px;
  display: flex;
  font-size: 20px;
  color: #8f8e8e;
}
</style>